package com.hopes.bizz.risk.activemq.config;

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.jms.ConnectionFactory;

/**
 * @author daijie
 * @version 1.0
 * @date 2023/5/26 14:32
 * @Description:
 */
@Configuration
public class ActiveMQConfiguration {
    @Value("${activemq.url}")
    private String url;
    @Value("${activemq.user}")
    private String user;
    @Value("${activemq.password}")
    private String password;

    @Bean
    public ConnectionFactory activeMqConnectionFactory() {
        // 必须暴露出来给Spring-boot，否则会抛出JMS health check错误
        return new ActiveMQConnectionFactory(url, user, password);
    }
}
